def intervalIntersection(firstList, secondList):
    intersections = []  # 存储交集结果
    i, j = 0, 0  # 初始化两个指针

    # 遍历两个区间列表
    while i < len(firstList) and j < len(secondList):
        start1, end1 = firstList[i]  # 获取第一个列表的当前区间
        start2, end2 = secondList[j]  # 获取第二个列表的当前区间

        # 计算交集的起始点和结束点
        start_intersect = max(start1, start2)
        end_intersect = min(end1, end2)

        # 如果有交集，添加到结果列表中
        if start_intersect <= end_intersect:
            intersections.append([start_intersect, end_intersect])

        # 移动指针到下一个区间
        # 移动结束点较小的区间的指针
        if end1 < end2:
            i += 1
        elif end2 < end1:
            j += 1
        else:
            # 如果两个区间的结束点相同，则同时移动两个指针
            i += 1
            j += 1

    return intersections

# 测试用例
firstList = [[0,2],[5,10],[13,23],[24,25]]
secondList = [[1,5],[8,12],[15,24],[25,26]]
print(intervalIntersection(firstList, secondList))